<?php
$file_name = "data/films.txt";
$file_path = realpath($file_name);
$films = array();
$file = fopen($file_path, "r");
$data = fgets($file);

while (!feof($file)) {
    $films[] = trim(fgets($file));
}
?>

<?php fclose($file); ?>


<?php foreach ($films as $line): ?>

    <?php if (!empty($line)): ?>

        <?php $film = explode(";", $line);
        ?>
        <?php if (isset($_GET['uid'])): ?>
            <?php if ((int) $_GET['uid'] == (int) $film[4]): ?>


                <img src = 'public/images/films/<?php echo $film[1]; ?>' ><br>
                <?php echo $film[2]; ?> 
                <?php echo $film[3]; ?>
                <?php echo $film[4]; ?>
                <br>


            <?php endif; ?>
        <?php endif; ?>
    <?php endif; ?>
<?php endforeach; ?>

